//盛最多水的容器
//测试链接 https://leetcode.cn/problems/container-with-most-water/description/
public class MaxArea {
    public int maxArea(int[] height) {
        /*
        利用单调性和双指针
        */
        int left = 0;
        int right = height.length-1;
        int volume = 0;
        while(left < right){
            volume = Math.max(volume, (right-left) * Math.min(height[left] , height[right])  );
            if(height[left] < height[right]) {
                left++;
            }else {
                right--;
            }

        }
        return volume;
    }
}
